package com.xxxx.server.controller;




import com.xxxx.server.pojo.Authority;
import com.xxxx.server.pojo.Lecturereverse;
import com.xxxx.server.pojo.RespBean;

import com.xxxx.server.service.ILecturereverseService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.web.bind.annotation.*;


import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author LT
 * @since 2022-02-27
 */
@Api(value = "讲座预定信息管理",tags = "讲座预定信息管理")
@RestController
@RequestMapping("")
public class LecturereverseController {

    @Autowired
    private ILecturereverseService lecturereverseService;

    @ApiOperation(value = "查询所有讲座预定信息")
    @GetMapping("/system/LectureReverseManagement/AddLectureReverse/list")
    public List<Lecturereverse> getAllAuthrity(){
        return  lecturereverseService.list();
    }


    /**
     * 通过登录用户id查询讲座预定信息
     * @param
     * @return
     */
    @ApiOperation(value = "通过用户关键字查询该用户所有讲座预定信息传入为空则查询所有")
    @GetMapping("/system/LectureReverseManagement/AddLectureReverse/listByid")
    public List<Lecturereverse> getALlLectureReverseByUserId(Lecturereverse lecturereverse)
    {

        return lecturereverseService.getALlLectureReverseByUserId(lecturereverse);
    }

    /**
     * 通过讲座id删除讲座预定信息
     * @param lecturereverse
     * @return
     */
    @ApiOperation(value = "删除讲座预定信息1")
    @DeleteMapping("/system/LectureReverseManagement/AddLectureReverse/delete")
    public RespBean deleteLectureReverseById(Lecturereverse lecturereverse){


      return lecturereverseService.deleteLectureReverseById(lecturereverse);

    }
    @ApiOperation(value = "更新讲座预定信息不适用")
    @PutMapping("/system/LectureReverseManagement/update")
    public RespBean updateLectureReverse(@RequestBody Lecturereverse lecturereverse)
    {
        if(lecturereverseService.updateById(lecturereverse))
        {
            return RespBean.success("更新成功！");
        }
        return RespBean.error("更新失败!");
    }


    @ApiOperation(value = "添加讲座预定信息1")
    @PostMapping("/system/LectureReverseManagement/AddLectureReverse/add")
    public RespBean addLectureReverse(@RequestBody Lecturereverse lecturereverse){

                    return lecturereverseService.addLectureReverse(lecturereverse);
    }

}
